﻿@model AutomatedTestDataManagement.Models.TestTestStep

@{
    ViewBag.Title = "Delete";
}

<h2>Delete</h2>

<h3>Are you sure you want to remove @Model.TestStep.StepDescription from @Model.Test.TestName?</h3>
<fieldset>
    <legend>TestTestStep</legend>

    <div class="display-label">
         @Html.Label("Test Name")
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.Test.TestName)
    </div>

    <div class="display-label">
         @Html.Label("Test Step Description")
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.TestStep.StepDescription)
    </div>

    <div class="display-label">
         @Html.Label("Step Number")
    </div>
    <div class="display-field">
        @Html.DisplayFor(model => model.StepNumber)
    </div>
</fieldset>
@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    <p>
        <input type="hidden" name="ReturnToView" id="ReturnToView" value="@ViewBag.ReturnToView" />
        <input type="submit" value="Delete" /> |
        @if (ViewBag.TestID != null)
        {
            <input type="hidden" name="TestID" id="TestID" value="@ViewBag.TestID" />
            if (ViewBag.ScenarioID != null)
            {
                <input type="hidden" name="ScenarioID" id="ScenarioID" value="@ViewBag.ScenarioID" />
                if (ViewBag.SuiteID != null)
                {
                    <input type="hidden" name="SuiteID" id ="SuiteID" value="@ViewBag.SuiteID" />
                    if(ViewBag.ReturnToView == "Edit")
                    {
                        @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID, suiteID = ViewBag.SuiteID }, null)
                    }
                    else
                    {
                        @Html.ActionLink("Return to Test", "Delete", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID, suiteID = ViewBag.SuiteID }, null)
                    }
                }
                else
                {
                    if(ViewBag.ReturnToView =="Edit")
                    {
                         @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID }, null)
                    }
                    else
                    {
                         @Html.ActionLink("Return to Test", "Delete", "Test", new { id = ViewBag.TestID, scenarioID = ViewBag.ScenarioID }, null)
                    }
                }
            }
            else
            {
                if (ViewBag.ReturnToView == "Edit")
                {
                    @Html.ActionLink("Return to Test", "Edit", "Test", new { id = ViewBag.TestID }, null)
                }
                else
                {
                    @Html.ActionLink("Return to Test", "Delete", "Test", new { id = ViewBag.TestID }, null)
                }
            }
        }
        else 
        {
            if (ViewBag.TestStepID != null)
            {
                <input type="hidden" name="TestStepID", id="TestStepID" value="@ViewBag.TestStepID">
                @Html.ActionLink("Return to Test Step", "Delete", "TestStep", new { id = ViewBag.TestStepID }, null)
            }
            else 
            {
                @Html.ActionLink("View all Tests", "Index", "Test")
            }
        }
    @Html.Partial("_TestSuiteNav")

    </p>
}
